import requests
from getExample import GetHtmlCode
from bs4 import BeautifulSoup
#0 百度

sum = 0.0
for n in range(1,31):
    sum += 1/n

print(sum)

def GetSougou(sougou_url):
    sougou_page = ["&page=1", "&page=2", "&page=3"]
    # sougou = open("text/sougou.txt", "a+")
    for i in range(0, 3):
        new_url = sougou_url + sougou_page[i]
        content_html = GetHtmlCode(new_url)
        if content_html is None:
            print("None")
            return None
        print(content_html)
        soup = BeautifulSoup(content_html, 'html.parser', from_encoding='utf-8')
        titles = soup.find_all('h3', class_="vrTitle bdtit")
        for title in titles:
            link = title.find('a')['href']
            # 得到正常链接
            s = requests.Session()
            s.headers['User-Agent'] = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Mobile Safari/537.36"
            r = s.get(link).url
            print(r)
            # sougou.write(r + '\n')
    # sougou.close()
